/*
 * @Author: your name
 * @Date: 2021-01-15 15:28:03
 * @LastEditTime: 2021-01-21 18:16:29
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \wxapp\pages\vehicle\shop\shop-detail\shop-detail.js
 */
var t = getApp(),
  e = t.requirejs("core");
t.requirejs("foxui");
Page({
  data: {
    /*name:"河源市联检机动车检测有限公司",
    phone:"0762-8333111",
    address:"广东省河源市和园区高糖解放路1号",
    service:[
      {
        imageUrl:"https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=2542054890,4291997804&fm=26&gp=0.jpg",
        title:"六年免检",
        subTitle:"六年免检",
        price:"320"
      },
      {
        imageUrl:"https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=2542054890,4291997804&fm=26&gp=0.jpg",
        title:"上线年检",
        subTitle:"六年免检",
        price:"320"
      },
      {
        imageUrl:"https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=2542054890,4291997804&fm=26&gp=0.jpg",
        title:"六年免检",
        subTitle:"六年免检",
        price:"320"
      },
      {
        imageUrl:"https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=2542054890,4291997804&fm=26&gp=0.jpg",
        title:"上线年检",
        subTitle:"六年免检",
        price:"320"
      },
    ]*/
    store: [],
    latitude: "",
    longitude: "",
  },
  onLoad: function (e) {
    var a = this;
    //获取当前的地理位置、速度
    wx.getLocation({
      type: 'wgs84', // 默认为 wgs84 返回 gps 坐标，gcj02 返回可用于 wx.openLocation 的坐标
      success: function (res) {
        //赋值经纬度
        a.setData({
          latitude: res.latitude,
          longitude: res.longitude,

        })
      }
    })

    this.getDetail(e)
  },
  getDetail: function (t) {
    var a = this;
    e.get("vehicle/shop/detail", {
      id: t.id
    }, function (t) {
      a.setData({
        store: t.store
      })
    })
  },
  btnClip: function () {
    console.log('click the btn');
    wx.navigateTo({
      url: 'pages/vehicle/service/service',
    });
  },
  call: function (e) {
    var number = e.currentTarget.dataset.mobile;
    wx.makePhoneCall({
      phoneNumber: number
    })
  },

  //导航
  onGuideTap: function (event) {
    var lat = Number(event.currentTarget.dataset.latitude);
    var lon = Number(event.currentTarget.dataset.longitude);
    var bankName = event.currentTarget.dataset.bankname;
    console.log(lat);
    console.log(lon);
    wx.openLocation({
      type: 'gcj02',
      latitude: lat,
      longitude: lon,
      name: bankName,
      scale: 28
    })
  },

})